package com.lightbend.akka.sample

import akka.actor.typed.{Behavior, PostStop, Signal}
import akka.actor.typed.scaladsl.{AbstractBehavior, ActorContext, Behaviors}

object IotSupervisor {
  def apply(): Behavior[Nothing] =
    Behaviors.setup[Nothing](context => new IotSupervisor(context))
}

class IotSupervisor(context: ActorContext[Nothing]) extends AbstractBehavior[Nothing](context = context){
  context.log.info("IoT Application started")


  override def onMessage(msg: Nothing): Behavior[Nothing] = {
    Behaviors.unhandled[Nothing]
  }

  override def onSignal: PartialFunction[Signal, Behavior[Nothing]] = {
    case stop: PostStop =>
      context.log.info(s"IoT Application stopped:{$stop}")
      this
  }
}



